#include "stdafx.h"
#include "ClassFactory.h"

VAMPIRE_NAMESPACE_BEGIN


void ClassFactory::registerFunction( const char* name, _createFunction fun )
{
	String className(name);
	if(strncmp(name, "class ", 6) == 0)
	{
		className = className.substr(className.rfind(" ") + 1);
	}
	mFunctionMap[className.c_str()] = fun;
}

void* ClassFactory::create( const char* name )
{
	return mFunctionMap[name]();
}

VAMPIRE_NAMESPACE_END